package com.ailesson.video.controller;

import java.util.Map;

import io.swagger.v3.oas.annotations.Parameters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.ailesson.video.service.VideoVisitorService;
import com.ailesson.common.reply.PageResult;
import com.ailesson.common.reply.R;



/**
 * 视频来访者记录表
 *
 * @author mac
 * @email mac@gmail.com
 * @date 2024-10-02 10:31:00
 */
@Tag(name = "视频来访者记录表模块")
@RestController
@RequestMapping("/admin/video/video-visitor")
public class VideoVisitorController {
    @Autowired
    private VideoVisitorService videoVisitorService;


    @Operation(summary = "统计在线观看人数")
    @GetMapping("/queryCount/{courseId}/{startDate}/{endDate}")
    @Parameters(value = {
            @Parameter(name = "courseId", in = ParameterIn.PATH, description = "课程ID"),
            @Parameter(name = "startDate", in = ParameterIn.PATH, description = "开始时间"),
            @Parameter(name = "endDate", in = ParameterIn.PATH, description = "结束时间")
    })
    private R queryCount(@PathVariable Long courseId,
                        @PathVariable String startDate,
                        @PathVariable String endDate) {
       Map<String,Object> map = videoVisitorService.queryCount(courseId,startDate,endDate);
        return R.success(map);
    }

   /* *//**
     * 列表
     *//*
    @PostMapping("/list")
    @Operation(summary = "列表")
    @Parameter(name = "params", in = ParameterIn.DEFAULT, description = "查询参数")
   // @RequiresPermissions("video:videovisitor:list")
    public R list(@RequestBody VideoVisitorQueryReq params){
        PageResult page = videoVisitorService.queryPage(params);

        return R.success(page);
    }


    *//**
     * 信息
     *//*
    @GetMapping("/info/{id}")
    @Operation(summary = "获取信息")
    @Parameter(name = "id",in = ParameterIn.PATH, description = "ID")
   // @RequiresPermissions("video:videovisitor:info")
    public R info(@PathVariable("id") Long id){
		VideoVisitorReply videoVisitor = videoVisitorService.info(id);

         return R.success(videoVisitor);
    }

    *//**
     * 保存
     *//*
    @PostMapping("/add")
    @Operation(summary = "添加")
    @Parameter(name = "teacher",in = ParameterIn.QUERY, description = "添加信息")
    //@RequiresPermissions("video:videovisitor:save")
    public R add(@RequestBody VideoVisitorReq videoVisitor){
        return R.success(videoVisitorService.add(videoVisitor));
    }

    *//**
     * 修改
     *//*
    @PutMapping("/update")
    @Operation(summary = "更新")
    @Parameter(name = "teacher",in = ParameterIn.QUERY, description = "更新信息")
    //@RequiresPermissions("video:videovisitor:update")
    public R update(@RequestBody VideoVisitorReq videoVisitor){
		videoVisitorService.update(videoVisitor);

        return R.success();
    }

    *//**
     * 删除
     *//*
    @DeleteMapping("/delete")
    @Operation(summary = "删除")
    @Parameter(name = "ids",in = ParameterIn.QUERY, description = "删除主键ids")
    //@RequiresPermissions("video:videovisitor:delete")
    public R delete(@RequestBody Long[] ids){
		videoVisitorService.removeByIds(Arrays.asList(ids));

        return R.success();
    }*/

}
